LIBS=gtk+-2.0 libmpd libglade-2.0
OBJS = main.o mpdmodel.o plist.o library.o
NODEPENDS = ui.o
TARGET = splayer

CFLAGS = `pkg-config --cflags $(LIBS)` -std=gnu99 -g -O0 -Wall
LDFLAGS = `pkg-config --libs $(LIBS)`
DEPS = $(OBJS:.o=.d)

all:$(TARGET)

$(TARGET): $(OBJS) $(NODEPENDS)
	$(CC) $(LDFLAGS) -o $@ $^

%.o: %.c Makefile
	$(CC) -c $(CFLAGS) -o $@ $<

%.d: %.c
	@echo Dependence for $<
	@$(CC) -M $(CFLAGS) $< > $@

%.c: %.xml
	mkres < $< -n $(<:.xml=) > $@

clean:
	@rm -vf $(NODEPENDS)
	@rm -vf $(DEPS)
	@rm -vf $(OBJS)
	@rm -vf $(TARGET)

-include $(DEPS)

